package zhh.tangbao.auxiliary.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import zhh.tangbao.auxiliary.entity.SystemMessage;
import zhh.tangbao.auxiliary.vo.message.MessageCountVo;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 *     描述
 * </p>
 * @author 粥灰灰
 * <p>2023/3/28</p>
 */

@Repository
@Mapper
public interface SystemMessageDao extends BaseMapper<SystemMessage> {
    int insertBatchSomeColumn(Collection<SystemMessage> messages);

    @Select("SELECT COUNT(id) count, is_read FROM system_message WHERE receive_user_id = #{id} GROUP BY is_read ")
    List<MessageCountVo> readAndUnReadMessageCountVo(@Param("id") String userId);
}
